﻿# Uninitialized variables return $null
write "`$newvar -eq `$null? $($newvar -eq $null)"

# You can test whether a variable has been initialized or not
write "test-path variable:newvar = $(test-path variable:newvar)"
$newvar = "new"
write "(after initialization) test-path variable:newvar = $(test-path variable:newvar)"

# List all currently existing variables
dir variable:/

# variables can be typed
$var = $null
$var = 1
$var = "abc"
$var = Get-Date

[int]$intvar = 2
[int]$intvar = "0123"
write $var

# Variable Names
# Simple notation starts with $ followed by sequence of characters, which can
#   include letters, numbers, underscore, and colon

# Brace notation starts with $ and wraps the variable name in {}
# Any character is allowed
${this is a variable name with a `} in it}

# Namespaces
# Variables can declare a namespace using :
$env:SystemRoot

